package com.pig4cloud.pigx.user.executor.contract.user;

import com.pig4cloud.pigx.common.customize.mysql.utils.TransactionInterface;
import com.pig4cloud.pigx.user.constant.UserMqConstant;
import com.pig4cloud.pigx.user.dto.TransactionThenDTO;
import com.pig4cloud.pigx.user.service.UserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

/**
 * 用户-燃料 燃料分配处理器
 *
 * @since 2022/11/27 19:51
 */
@Slf4j
@Component
@EnableScheduling
@RequiredArgsConstructor
public class UserFuelCheckHandler implements TransactionInterface {

	private final UserService userService;

	@RabbitListener(queues = UserMqConstant.QUEUE_FANOUT_USER_FUEL_CHECK)
	public void run(TransactionThenDTO dto) {
		userService.transactionThen(dto);
	}

}
